#define FFI_LIB "libxxhash.so"

typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;

typedef uint32_t XXH32_hash_t;

struct XXH32_state_s {
   XXH32_hash_t total_len;
   XXH32_hash_t large_len;
   XXH32_hash_t v1;
   XXH32_hash_t v2;
   XXH32_hash_t v3;
   XXH32_hash_t v4;
   XXH32_hash_t mem32[4];
   XXH32_hash_t memsize;
   XXH32_hash_t reserved;   /* never read nor write, might be removed in a future version */
};   /* typedef'd to XXH32_state_t */

typedef struct XXH32_state_s XXH32_state_t; /* incomplete type (pointer only) */

extern XXH32_hash_t XXH32 (const void* input, size_t length, XXH32_hash_t seed);

extern XXH32_state_t* XXH32_createState(void);
extern XXH_errorcode  XXH32_freeState(XXH32_state_t* statePtr);
extern void           XXH32_copyState(XXH32_state_t* dst_state, const XXH32_state_t* src_state);

extern XXH_errorcode XXH32_reset  (XXH32_state_t* statePtr, XXH32_hash_t seed);
extern XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length);
extern XXH32_hash_t  XXH32_digest (const XXH32_state_t* statePtr);

typedef struct { unsigned char digest[4]; } XXH32_canonical_t;
extern void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash);
extern XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src);
